package com.well.rpc.register.ribbon;

import com.netflix.loadbalancer.Server;

import java.util.Map;

public class WdServer extends Server {
    private final MetaInfo metaInfo;
    private final Instance instance;
    private final Map<String, String> metadata;
    public WdServer(final Instance instance) {
        super(instance.getIp(), instance.getPort());
        this.instance = instance;
        this.metaInfo = new MetaInfo() {
            public String getAppName() {
                return instance.getServiceName();
            }

            public String getServerGroup() {
                return null;
            }

            public String getServiceIdForDiscovery() {
                return null;
            }

            public String getInstanceId() {
                return instance.getInstanceId();
            }
        };
        this.metadata = instance.getMetadata();
    }

    public MetaInfo getMetaInfo() {
        return this.metaInfo;
    }

    public Instance getInstance() {
        return this.instance;
    }

    public Map<String, String> getMetadata() {
        return this.metadata;
    }
}
